#!/bin/bash

# 部署配置
local_path="/Users/xiaohao/Documents/Java/restaurant-system/restaurant-system-web"
remote_path="/usr/share/nginx/html/res-sys/"
remote_user_host="root@xiaohaoo.com"

echo '> 开始打包'
cd $local_path || exit
npm run build:prod || exit

echo '> 开始上传'
ssh -Tq  $remote_user_host <<EOF
mkdir -p $remote_path
rm -rf $remote_path/*
exit
EOF

scp -r $local_path/build/* $remote_user_host:$remote_path || exit

echo -e "\033[32m> 部署完成\033[0m"
